import 'package:flutter/material.dart';

import 'AnimatedDecoratedBox1.dart';


void main() {
  runApp(MaterialApp(
    home: Scaffold(
      appBar: AppBar(
        title: const Text("Animation Widget Demo"),
      ),
      body: AnimatedDecoratedBoxWidget(),
    ),
  ));
}

class AnimatedDecoratedBoxWidget extends StatefulWidget {
  const AnimatedDecoratedBoxWidget({Key? key}) : super(key: key);

  @override
  _AnimatedDecoratedBoxWidgetState createState() =>
      _AnimatedDecoratedBoxWidgetState();
}

class _AnimatedDecoratedBoxWidgetState
    extends State<AnimatedDecoratedBoxWidget> {

  Color _decorationColor = Colors.blue;
  var duration = const Duration(seconds: 1);

  @override
  Widget build(BuildContext context) {
    return AnimatedDecoratedBox1(
      duration: duration,
      decoration: BoxDecoration(color: _decorationColor),
      child: TextButton(
        onPressed: () {
          setState(() {
            _decorationColor = Colors.red;
          });
        },
        child: const Text(
          "AnimatedDecoratedBox",
          style: TextStyle(color: Colors.white),
        ),
      ),
    );
  }
}
